var operation = {
	getClient: function(type) {
		$.getJSON('user?action=getClient',{flag: type}, function(response) {
			return response;
		});
	}
};


function getClient(type) {
	return $.getJSON('user?action=getClient',{flag: type});
}

function delClient(id, callback) {
	$.post('/user?action=delClient', {clientid: id}, function(response) {
		callback(response);
	}, "json");
}

function clientCheckIn(id, callback) {
	$.post('/user?action=clientCheckIn', {clientid: id}, function(response) {
		callback(response);
	}, "json");
}

function assignTable(id, tableType, callback) {
	$.post('/user?action=assignTable', {clientid: id, table: tableType}, function(response) {
		callback(response);
	}, "json");
}

function finishedEating(id, callback) {
	$.post('/user?action=finishedEating', {clientid: id}, function(response) {
		callback(response);
	}, "json");
}

function clientNotify(id, callback) {
	$.post('/user?action=clientNotify', {clientid: id}, function(response) {
		callback(response);
	}, "json");
}

function getShopState(time) {
	$.getJSON('/user?action=getShopState', function(response) {
		$('#maxOrderNum').text(response.maxNum);
		$('#currentOrderNum').text(response.cuttentNum);
	});
	time = (time == null)?60000:time;
	console.log(time);
	setTimeout("getShopState(" + time + ")", time);
}

function shopSwitch(flag, callback) {
	$.post('/user?action=shopSwitch', {switch: flag}, function(response) {
		callback(response);
	}, "json");
}
